package listener;

import gui.DayPopUp;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

public class MyItemListener implements ItemListener {

	private DayPopUp dpu;

	public MyItemListener(DayPopUp dpu) {
		this.dpu = dpu;
	}

	@Override
	public void itemStateChanged(ItemEvent sourceEvent) {

		if (sourceEvent.getStateChange() == ItemEvent.SELECTED) {
			int start = dpu.getMyText().getSelectionStart();
			int end = dpu.getMyText().getSelectionEnd();
			if (start >= end) {
				start = 0;
				end = dpu.getMyText().getText().length();
			}
		}
	}
}
